Skip to content

Conversation

@solidsnakedev
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings September 1, 2025 22:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements module upgrades and introduces a new SDK directory structure to support provider and wallet functionality.

  • Module restructuring from Address to AddressEras for better era-specific address handling
  • Addition of SDK provider architecture with Kupo/Ogmios integration and type definitions
  • New wallet utilities including seed-based wallet generation and script handling functionality

Reviewed Changes

Copilot reviewed 24 out of 29 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/evolution/test/WalletFromSeed.test.ts Test suite for wallet generation from seed phrases with different configurations
packages/evolution/test/Script.CML.test.ts CBOR compatibility tests between Evolution SDK and Cardano Multiplatform Library
packages/evolution/src/sdk/wallet/utils.ts Wallet utility functions for generating wallets from BIP39 seed phrases
packages/evolution/src/sdk/wallet/Wallet.ts Duplicate wallet implementation (identical to utils.ts)
packages/evolution/src/sdk/provider/types.ts Provider interface definitions and supporting types
packages/evolution/src/sdk/provider/internal/Ogmios.ts Ogmios JSON-RPC protocol schemas and data transformations
packages/evolution/src/sdk/provider/internal/Kupo.ts Kupo API schemas for UTxO and delegation data
packages/evolution/src/sdk/provider/internal/HttpUtils.ts HTTP utility functions for GET/POST requests with schema validation
packages/evolution/src/sdk/provider/Provider.ts Provider service interface and error handling
packages/evolution/src/sdk/provider/Kupmios.ts Kupmios provider implementation combining Kupo and Ogmios
packages/evolution/src/sdk/UTxO.ts UTxO data structures and utility functions
packages/evolution/src/sdk/Script.ts User-facing script types and hash computation utilities
packages/evolution/src/sdk/Assets.ts Asset manipulation and validation functions
packages/evolution/src/index.ts Export path updates for module restructuring
packages/evolution/src/TransactionOutput.ts Address import path updates
packages/evolution/src/TransactionBody.ts Code formatting improvements
packages/evolution/src/ScriptHash.ts Script hash computation implementation
packages/evolution/src/Script.ts CBOR encoding/decoding function additions
packages/evolution/src/NetworkId.ts Schema brand removal
packages/evolution/src/Bytes.ts Parameter simplification in validation functions
packages/evolution/src/AddressStructure.ts New unified address structure handling
packages/evolution/src/AddressEras.ts Era-specific address type definitions
packages/evolution/src/AddressDetails.ts Address import path updates
packages/evolution/package.json Effect platform dependency addition
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +13 to +83
export type Wallet = {
address: string
rewardAddress: string | null
paymentKey: string
stakeKey: string | null
}

export function walletFromSeed(
seed: string,
options: {
password?: string
addressType?: "Base" | "Enterprise"
accountIndex?: number
network?: "Mainnet" | "Testnet" | "Custom"
} = {}
): Wallet {
//Set default options
const { accountIndex = 0, addressType = "Base", network = "Mainnet" } = options

// Derive extended root from BIP39 entropy using our ed25519-bip32 (V2) implementation
const entropy = mnemonicToEntropy(seed, English)
const rootXPrv = Bip32PrivateKey.fromBip39Entropy(entropy, options?.password ?? "")

// Derive child keys using CIP-1852 indices
const paymentIndices = Bip32PrivateKey.CardanoPath.paymentIndices(accountIndex, 0)
const stakeIndices = Bip32PrivateKey.CardanoPath.stakeIndices(accountIndex, 0)
const paymentNode = Bip32PrivateKey.derive(rootXPrv, paymentIndices)
const stakeNode = Bip32PrivateKey.derive(rootXPrv, stakeIndices)

// Convert to standard PrivateKey (64 bytes: scalar+iv)
const paymentKey = Bip32PrivateKey.toPrivateKey(paymentNode)
const stakeKey = Bip32PrivateKey.toPrivateKey(stakeNode)

const paymentKeyHash = KeyHash.fromPrivateKey(paymentKey)
const stakeKeyHash = KeyHash.fromPrivateKey(stakeKey)

const networkId = network === "Mainnet" ? 1 : 0

const address =
addressType === "Base"
? Address.toBech32(
new BaseAddress.BaseAddress({
networkId: NetworkId.make(networkId),
paymentCredential: paymentKeyHash,
stakeCredential: stakeKeyHash
})
)
: Address.toBech32(
new EnterpriseAddress.EnterpriseAddress({
networkId: NetworkId.make(networkId),
paymentCredential: paymentKeyHash
})
)

const rewardAddress =
addressType === "Base"
? Address.toBech32(
new RewardAccount.RewardAccount({
networkId,
stakeCredential: stakeKeyHash
})
)
: null

return {
address,
rewardAddress,
paymentKey: PrivateKey.toBech32(paymentKey),
stakeKey: addressType === "Base" ? PrivateKey.toBech32(stakeKey) : null
}
}
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is an exact duplicate of utils.ts. Consider removing this duplicate file and importing the function from utils.ts instead.

Suggested change
export type Wallet = {
address: string
rewardAddress: string | null
paymentKey: string
stakeKey: string | null
}
export function walletFromSeed(
seed: string,
options: {
password?: string
addressType?: "Base" | "Enterprise"
accountIndex?: number
network?: "Mainnet" | "Testnet" | "Custom"
} = {}
): Wallet {
//Set default options
const { accountIndex = 0, addressType = "Base", network = "Mainnet" } = options
// Derive extended root from BIP39 entropy using our ed25519-bip32 (V2) implementation
const entropy = mnemonicToEntropy(seed, English)
const rootXPrv = Bip32PrivateKey.fromBip39Entropy(entropy, options?.password ?? "")
// Derive child keys using CIP-1852 indices
const paymentIndices = Bip32PrivateKey.CardanoPath.paymentIndices(accountIndex, 0)
const stakeIndices = Bip32PrivateKey.CardanoPath.stakeIndices(accountIndex, 0)
const paymentNode = Bip32PrivateKey.derive(rootXPrv, paymentIndices)
const stakeNode = Bip32PrivateKey.derive(rootXPrv, stakeIndices)
// Convert to standard PrivateKey (64 bytes: scalar+iv)
const paymentKey = Bip32PrivateKey.toPrivateKey(paymentNode)
const stakeKey = Bip32PrivateKey.toPrivateKey(stakeNode)
const paymentKeyHash = KeyHash.fromPrivateKey(paymentKey)
const stakeKeyHash = KeyHash.fromPrivateKey(stakeKey)
const networkId = network === "Mainnet" ? 1 : 0
const address =
addressType === "Base"
? Address.toBech32(
new BaseAddress.BaseAddress({
networkId: NetworkId.make(networkId),
paymentCredential: paymentKeyHash,
stakeCredential: stakeKeyHash
})
)
: Address.toBech32(
new EnterpriseAddress.EnterpriseAddress({
networkId: NetworkId.make(networkId),
paymentCredential: paymentKeyHash
})
)
const rewardAddress =
addressType === "Base"
? Address.toBech32(
new RewardAccount.RewardAccount({
networkId,
stakeCredential: stakeKeyHash
})
)
: null
return {
address,
rewardAddress,
paymentKey: PrivateKey.toBech32(paymentKey),
stakeKey: addressType === "Base" ? PrivateKey.toBech32(stakeKey) : null
}
}
import { Wallet, walletFromSeed } from "../utils.js"

Copilot uses AI. Check for mistakes.
Comment on lines +197 to +200
export const getUtxos = (kupoUrl: string, headers?: { [key: string]: string }) =>
Effect.fn("getUtxos")(function* (
addressOrCredential: EnterpriseAddress.EnterpriseAddress | BaseAddress.BaseAddress | Credential.Credential
) {
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import statements for Credential, KupmiosError, Script, Address, and applyDoubleCborEncoding types/functions that are referenced but not imported.

Copilot uses AI. Check for mistakes.
})
}).annotations({ identifier: "RedeemerSchema" })

export const toOgmiosUTxOs = (utxos: Array<CoreType.UTxO> | undefined): Array<UTxO> => {
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing import statement for CoreType which is referenced but not imported.

Copilot uses AI. Check for mistakes.
@solidsnakedev solidsnakedev merged commit e0bc87b into main Sep 3, 2025
2 of 5 checks passed
@solidsnakedev solidsnakedev deleted the feat/upgrade-modules-7 branch September 3, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants